package com.xiyou.luckdraw.api.dto.user;

import com.xiyou.luckdraw.common.result.AbstractRequest;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import org.springframework.data.domain.Sort;

/**
 * @ClassName: ActiveUserRequest
 * @Description: 获取Mongodb活跃用户请求参数
 * @author: limingxing
 * @Date: 2019-10-24 14:48
 */
@Data
@ApiModel(value = "获取Mongodb活跃用户请求参数")
public class ActiveUserRequest extends AbstractRequest {

    @ApiModelProperty(value = "开始时间")
    private String startTime;
    @ApiModelProperty(value = "结束时间")
    private String endTime;
    @ApiModelProperty(value = "页码", example = "1")
    private Integer page;
    @ApiModelProperty(value = "页大小", example = "10")
    private Integer size;
    @ApiModelProperty(value = "排序(DESC,ASC)")
    private String sort;

    @Override
    public void requestCheck() {
        if (page == null || page < 1) {
            page = 1;
        }
        if (size == null || size < 1) {
            size = 10;
        }
        if(StringUtils.isEmpty(sort)){
            sort = "DESC";
        }
    }

}
